export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'zwjun',
    // htmlAttrs: {
    //   lang: 'en'
    // },
    // meta: [
    //   { charset: 'utf-8' },
    //   { name: 'viewport', content: 'width=device-width, initial-scale=1' },
    //   { hid: 'description', name: 'description', content: '' },
    //   { name: 'format-detection', content: 'telephone=no' }
    // ],
    // link: [
    //   { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
    //   { rel: 'stylesheet', href: '/font/Tangerine.ttf' }
    // ]
  },

  router: {
    middleware: 'auth',
    extendRoutes(router, resolve) {
      router.push({
        path: '/',
        redirect: '/home'
      })
    }
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    '@/assets/css/reset.css',
    '@/assets/css/global.css',
    'element-ui/lib/theme-chalk/index.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    "@/plugins/scrollMixin.js",
    "@/plugins/axios.js",
    "@/plugins/vueGlobal.js",
    "@/plugins/router.js",
    { src: '@/plugins/element-ui', ssr: true }
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    "@nuxtjs/axios",
    'cookie-universal-nuxt'
  ],

  axios: {
    proxy: true,
    // prefix: '/api',  请求时自动补充前缀
    credentials: true,
  },

  proxy: { // 代理
    '/api': {
      target: 'http://xxx:3001', // 代理地址
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    }
  },

  loading: "@/components/Loading.vue",

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/]
  }
}
